<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <link rel="stylesheet" type="text/css" href="element-ui/lib/theme-chalk/index.css"/>
  <script src="js/vue.min.js"></script>
  <script src="element-ui/lib/index.js"></script>
  <script src="js/axios.min.js"></script>
</head>
<body>
<div id="app">
    <div>
        标题名：<span v-text="pst.postTitle"></span></br>
        发帖人：<span v-text="pst.account.accUsername"></span></br>
        发帖时间：<span v-text="pst.postDate"></span></br>
        内容：<span v-text="pst.postContent"></span>
    </div>
</div>
</body>

<script>
  let vu = new Vue({
    el: "#app",
    data: {
      pst:{}
    },
    methods: {
      showPostById(pid) {
        axios.get("/post/"+pid).then(rs=>{
          vu.pst = rs.data

        })
      }


    },
    created() {
      // 接收请求的id
      var urlSearchParams = new URLSearchParams(window.location.search);
      // 获取id
      let pid=urlSearchParams.get("postId")
      // 调用查询方法
      this.showPostById(pid)

    }
  })

</script>
</html>